//
//  SSTabBarController.swift
//  拾舍清洁
//
//  Created by sky.wei on 2023/2/6.
//

import UIKit

class SSMainTabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        UITabBar.appearance().backgroundColor = UIColor.white
        

        addChild(SSTargetViewController.init(), title: "首页", imageName:"tabbar_home" )
        addChild(SSOrderListViewController.init(), title: "订单", imageName:"tabbar_order")
        addChild(SSMineViewController.init(), title: "我的", imageName:"tabbar_mine")
    }
    

    ///添加子视图
    func addChild(_ childController: UIViewController, title:String, imageName:String = "tabbar_home") {
        
        let childViewController = childController
        childViewController.title = title;
        childViewController.tabBarItem.image = UIImage.init(named: imageName)
        childViewController.tabBarItem.selectedImage = UIImage.init(named: imageName + "_highlighted")
        
//        let nav = UINavigationController.init(rootViewController: childViewController)
        let nav = NavigationController(rootViewController: childViewController)
        addChild(nav)
    
    }

}
